package com.ocr.utils;

import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;

public class BingTranslate {

	public static String translate(String text, String fromlang, String tolang) {
		Translate.setKey(Constains.BING_TRANSLATE_API_KEY);

		String translatedText = null;
		try {
			translatedText = Translate.execute(text,
					Language.valueOf(fromlang.toUpperCase()),
					Language.valueOf(tolang.toUpperCase()));

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		return translatedText;
	}
}
